﻿@{
    Layout = "~/Views/Shared/Index_Layout.cshtml";
}
<div style="margin: 10px 10px 10px 10px">
    <form class="layui-form layui-form-pane" action="">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">时间</label>
                <div class="layui-input-inline">
                    <input id="CreatedTimeStartDate" name="CreatedTimeStartDate" type="text" class="layui-input" placeholder="开始时间" />
                </div>

                <div class="layui-input-inline">
                    <input id="CreatedTimeEndDate" name="CreatedTimeEndDate" type="text" class="layui-input" placeholder="结束时间" />
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">用户</label>
                <div class="layui-input-inline">
                    <input name="Name" type="text" class="layui-input" />
                </div>

            </div>

            <div class="layui-inline">
                <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
            </div>
        </div>
    </form>
</div>
<table class="layui-hide" id="standardtable" lay-filter="standardtableFilter"></table>


<script>

    layui.use(function() {
        var $ = layui.jquery,
            table = layui.table,
            form = layui.form,
            GSLayui = layui.GSLayui;

        var laydate = layui.laydate;

        laydate.render({
            elem: "#CreatedTimeStartDate",
            format: 'yyyy-MM-dd',
            type: "date",
            range: false
        });
        laydate.render({
            elem: "#CreatedTimeEndDate",
            format: 'yyyy-MM-dd',
            type: "date",
            range: false
        });

        var cols = [
            { title: "序号", width: 60, templet: function(d) { return d.LAY_INDEX; } },
            { field: "Name", width: "10%", title: "用户" },
            { field: "CreatedTime", width: "25%", title: "创建时间" },
            { field: "Ip", width: "10%", title: "Ip地址" },
            { field: "Result", width: "10%", title: "结果" },
            { field: "MenuId", width: "10%", title: "模块" },
            { field: "Message", title: "内容" },


        ];

        var standtable = GSLayui.layuiTable("standardtable", "/SysLog/DataSysLog", cols)
         standtable.toolbar= null,

        table.render(standtable);
        // 监听搜索操作
        form.on('submit(data-search-btn)', function(data) {

            var tableform = data.field;
             
            //重载
            table.reload('standardtable', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                , where: tableform
            });

            return false;
        });


    });




</script>